<?php

use backend\widgets\Alert;
use yii\bootstrap\ActiveForm;
use yii\grid\GridView;
use common\models\Teacher;
?>
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-sm-4">
        <h2><?php echo $this->title?></h2>
        <ol class="breadcrumb">
            <li>
                <a href="<?php echo yii::$app->urlManager->createUrl(['site/index'])?>"><strong>Trang chủ</strong></a>
            </li>
            <li class="active">
                <strong><?php echo $this->title?></strong>
            </li>
        </ol>
    </div>
    <div class="nav navbar-top-links navbar-right" id="action-group">
        <a href="<?php echo yii::$app->urlManager->createUrl(['company/add'])?>" class="btn btn-primary"><i class="fa fa-plus-square"></i> Thêm Công ty</a>
    </div>
    
</div>
<div class="wrapper wrapper-content">
    <div class="row">
        <?php echo Alert::widget() ?> 
        
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5> Quản lý  <small>Công ty</small></h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>

                    </div>
                </div>
                <div class="ibox-content">
                    
                    <?php
                    echo GridView::widget([
                        'dataProvider' => $dataProvider,
                        'filterModel' => $searchModel,
                        'columns' => [
                            [
                                'attribute' => 'id_company',
                                'format' => 'text',
                                'label' => 'Id',
                                'contentOptions' => ['style' => 'width: 80px;text-align:center;vertical-align: middle;'],
                                'headerOptions' => ['style'=>'width: 80px;text-align:center'],
                            ],
                            [
                                'class' => 'yii\grid\DataColumn',
                                'attribute' => 'name',
                                'contentOptions' => ['style' => 'width: 20%;vertical-align: middle;']
                            ],
                            [
                                'class' => 'yii\grid\DataColumn',
                                'attribute' => 'email',
                                'contentOptions' => ['style' => 'width: 20%;vertical-align: middle;']
                            ],
                            [
                                'class' => 'yii\grid\DataColumn',
                                'attribute' => 'address',
                                'contentOptions' => ['style' => 'width: 20%;vertical-align: middle;']
                            ],
                            [
                                'class' => 'yii\grid\DataColumn',
                                'attribute' => 'created',
                                'format' => 'html',
                                'value' => function ($data) {
                                    return date('Y-m-d',strtotime($data->created));
                                },
                                'contentOptions' => ['style' => 'vertical-align: middle;']
                            ],
                            
                            
                            [
                                'class' => 'yii\grid\DataColumn',
                                'label' => 'action',
                                'format' => 'html',
                                'value' => function ($data) {
                                    return "<a class='btn btn-sm btn-warning' href='" . yii::$app->urlManager->createUrl(['company/edit', 'id' => $data->id_company]) . "'><i class='fa fa-edit'></i> Sửa</a>&nbsp;" ."&nbsp;<a class='btn btn-sm btn-danger class_delete' href='" . yii::$app->urlManager->createUrl(['company/delete', 'id' => $data->id_company]) . "'><i class='fa fa-remove'></i> Xóa</a>";
                                },
                                'contentOptions' => ['style' => 'width: 150px;vertical-align: middle;']
                            ],
                            
                                ],
                            ]);
                            ?>
                </div>
            </div>
        </div>
    </div>
</div>

